#ifndef MUSICSLIDER_H
#define MUSICSLIDER_H
#include <QWidget>
#include<QMouseEvent>
namespace Ui {
class MusicSlider;
}

class MusicSlider : public QWidget
{
    Q_OBJECT

public:
    explicit MusicSlider(QWidget *parent = nullptr);
    void setStep(float bf);
    ~MusicSlider();
protected:
    //事件重写
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void resizeEvent(QResizeEvent *event);


signals:
    void setMusicSliderPosition(float ratio);
private:
    void moveSlider();
private:
    Ui::MusicSlider *ui;
    int currentPos; //播放总速度
    int maxWidth; //进度条总长度


};

#endif // MUSICSLIDER_H
